/* Copyright (c) 2010 OFXKit
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import <Foundation/Foundation.h>

#import "OFXSecurity.h"
#import "OFXInvestmentTransaction.h"
#import "OFXInvestmentAccount.h"

typedef enum {
  INVESTMENT_BUY,
  INVESTMENT_BUY_TO_COVER
} OFXInvestmentBuyType;

@interface OFXInvestmentBuyTransaction : OFXInvestmentTransaction {
  OFXSecurity* security;
  NSNumber* units;
  NSNumber* unitPrice;
  NSNumber* unitPriceMarkUp;
  NSNumber* commission;
  NSNumber* taxes;
  NSNumber* fees;
  NSNumber* load;
  NSNumber* totalAmount;
  NSNumber* withholding;
  NSNumber* stateWithholding;
  NSString* loanId;
  NSNumber* loanInterestRate;
  NSNumber* loanPrincipal;
  bool priorYear401kContribution;
  NSDate*   dateOfPayrollDeduction;
  
  NSString* securitySubAccount;
  NSString* fundingSubAccount;
}

/**
 * @property security
 * @brief Security to purchase
 */
@property(retain) OFXSecurity* security;

/**
 * @property units
 * @brief Number of units to purchase
 */
@property(retain) NSNumber* units;

/**
 * @property unitPrice
 * @brief Unit price of transaction
 */
@property(retain) NSNumber* unitPrice;

/**
 * @property unitPriceMarkUp
 * @brief Portion of the unit price that is attributed to the dealer markup
 */
@property(retain) NSNumber* unitPriceMarkUp;

/**
 * @property commission
 * @brief Amount of commission charged in transaction
 */
@property(retain) NSNumber* commission;

/**
 * @property taxes
 * @brief Amount of taxes withheld in transaction
 */
@property(retain) NSNumber* taxes;

/**
 * @property fees
 * @brief Amount of other fees charged in transaction.
 */
@property(retain) NSNumber* fees;

/**
 * @property load
 * @brief Amount of load applied to transaction.
 */
@property(retain) NSNumber* load;

/**
 * @property totalAmount
 * @brief Total amount of transaction
 */
@property(retain) NSNumber* totalAmount;

/**
 * @property withholding
 * @brief Amount of federal taxes withheld
 */
@property(retain) NSNumber* withholding;

/**
 * @property stateWithholding
 * @brief Amount of state taxes withheld.
 */
@property(retain) NSNumber* stateWithholding;

/**
 * @property loanId
 * @brief For 401(k) accounts only. Indicates that the transaction was due to a
 * loan or a loan repayment, and which loan it was. A-32
 */
@property(retain) NSString* loanId;

/**
 * @property loanInterestRate
 * @brief For 401(k) accounts only. Indicates how much of the loan repayment 
 * was interest.
 */
@property(retain) NSNumber* loanInterestRate;

/**
 * @property loanPrincipal
 * @brief For 401(k) accounts only. Indicates how much of the loan repayment 
 * was principal.
 */
@property(retain) NSNumber* loanPrincipal;

/**
 * @property priorYear401kContribution
 * @brief For 401(k) accounts, indicates that this Buy was made with a prior 
 * year contribution.
 */
@property(assign) bool priorYear401kContribution;

/**
 * @property dateOfPayrollDeduction
 * @brief For 401(k)accounts, date the funds for this transaction was obtained
 * via payroll deduction
 */
@property(retain) NSDate*   dateOfPayrollDeduction;

/**
 * @property securitySubAccount
 * @brief Sub-account type for the security: CASH, MARGIN, SHORT, OTHER
 */
@property(retain) NSString* securitySubAccount;

/**
 * @property fundingSubAccount
 * @brief Where did the money for the transaction come from or go to? 
 * 
 * Valid values:
 * - CASH
 * - MARGIN
 * - SHORT
 * - OTHER
 */
@property(retain) NSString* fundingSubAccount;

/**
 * Initialize object.
 */
- (id)init;

@end
